﻿using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Authorization;
using AbpZeroTemplate.Authorization;
using AbpZeroTemplate.MultiTenancy.Dto;
using AbpZeroTemplate.MultiTenancy.Payments;
using AbpZeroTemplate.MultiTenancy.Payments.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>帐号相关
    /// </summary>
    [Area("Admin")]
    [Route("Admin/Payment/[action]")]
    [ApiName("Admin")]
    [RemoteService]
    [AbpMvcAuthorize]
    public class PaymentController: AbpZeroTemplateControllerBase
    {
        private readonly IPaymentAppService _paymentAppService;
        public PaymentController(IPaymentAppService paymentAppService)
        {
            _paymentAppService = paymentAppService;
        }

        [HttpGet]
        [AbpAuthorize(AppPermissions.Pages_Administration_Tenant_SubscriptionManagement)]
        public async Task<PaymentInfoDto> GetPaymentInfo(PaymentInfoInput input)
        {
            return await _paymentAppService.GetPaymentInfo(input);
        }

        [HttpPost]
        public async Task<CreatePaymentResponse> CreatePayment([FromBody]CreatePaymentDto input)
        {
            return await _paymentAppService.CreatePayment(input);
        }

        [HttpPost]
        public async Task<ExecutePaymentResponse> ExecutePayment([FromBody]ExecutePaymentDto input)
        {
            return await _paymentAppService.ExecutePayment(input);
        }

        [HttpGet]
        public async Task<PagedResultDto<SubscriptionPaymentListDto>> GetPaymentHistory(GetPaymentHistoryInput input)
        {
            return await _paymentAppService.GetPaymentHistory(input);
        }


    }
}
